function AddStoreAssistant(sceneAssistant) {
	this.sceneAssistant = sceneAssistant;
}

AddStoreAssistant.prototype.setup = function(widget) {
	
	config.log("in setup");
	
	this.model = {
		name: ""
	}
	
	this.widget = widget;
	try {
	this.sceneAssistant.controller.setupWidget("storeName",
		    this.nameAttributes = {
		      modelProperty: "name",
		      limitResize: true,
		      textReplacement: false,
		      enterSubmits: false,
		      autoFocus: true,
			  focus: true,
			  textCase: Mojo.Widget.steModeTitleCase			  
		    },
		    this.model
		);
	
	this.sceneAssistant.controller.setupWidget("okButton2",
		    {},
		    this.buttonModel = {
		      buttonLabel: "Add Store",
		      buttonClass: "affirmative"
		    }
		  );

		Mojo.Event.listen($('okButton2'), Mojo.Event.tap, this.checkStore.bind(this));
	} catch(e) {
		config.log(e.message);
	}
	
	config.log("setup done");
};

AddStoreAssistant.prototype.checkStore = function(event) {
	config.log("in checkStore");
	if (this.model.name == "")
		return;
		
	dbHelper.insertStore(this.model, this.insertSuccess.bind(this), this.insertError.bind(this));

}

AddStoreAssistant.prototype.insertSuccess = function(event) {
	this.sceneAssistant.storeAdded(event);
	console.log("insert success");
	this.widget.mojo.close();
}

AddStoreAssistant.prototype.insertError = function(error) {
	console.log(Object.toJSON(error));
	this.widget.mojo.close();
}


AddStoreAssistant.prototype.activate = function(event) {
	/* put in event handlers here that should only be in effect when this scene is active. For
	   example, key handlers that are observing the document */
	$('storeName').mojo.focus();
};

AddStoreAssistant.prototype.deactivate = function(event) {
	/* remove any event handlers you added in activate and do any other cleanup that should happen before
	   this scene is popped or another scene is pushed on top */
};

AddStoreAssistant.prototype.cleanup = function(event) {
	/* this function should do any cleanup needed before the scene is destroyed as 
	   a result of being popped off the scene stack */
};

